package com.ytf.core.web.service.impl;

import com.ytf.core.web.pojo.model.User;
import com.ytf.core.web.mapper.UserMapper;
import com.ytf.core.web.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author YTF
 * @since 2025-05-20
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

    @Override
    public Boolean existsById(Long id) {
        return lambdaQuery().eq(User::getId, id).exists();
    }

    @Override
    public User getByUsername(String username) {
        return lambdaQuery().eq(User::getUsername, username).one();
    }

    @Override
    public User getByMobile(String mobile) {
        return lambdaQuery().eq(User::getMobile, mobile).one();
    }

    @Override
    public User getByEmail(String email) {
        return lambdaQuery().eq(User::getEmail, email).one();
    }
}
